package com.yahoo.labs.snow.util;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import cern.colt.list.DoubleArrayList;

public class MathUtilsTest {

	@Before
	public void setUp() throws Exception {
	}

	@Test
	public void testMedian() {
		Assert.assertEquals(5.0, MathUtils.median(new DoubleArrayList(new double[] {1.0, 10.0, 4.0, 5.0, 13.0})), 1e-8);
		Assert.assertEquals(7.5, MathUtils.median(new DoubleArrayList(new double[] {1.0, 10.0, 4.0, 5.0, 13.0, 15.0})), 1e-8);
	}

}
